#!/usr/bin/perl -w
use strict;

$/ = '>';

my $cnt_stops = 0;
die "Usage:\n\tcount_stop_codons_in_fasta.pl stop_codons.errors < test.fa > number_of_stops\n"
unless @ARGV;
{
	open OUTFILE, ">$ARGV[0]" or die "Could not open $ARGV[0]\n";
	while (<STDIN>)
	{
		if (/\*/)
		{
			$cnt_stops++;
			print OUTFILE ">$_";
		}
	}
}
unlink ($ARGV[0]) unless $cnt_stops;
print $cnt_stops;
